翻訳と辞書
Words near each other
・ Perl (disambiguation)
・ Perl 5 version history
・ Perl 6
・ Perl 6 rules
・ Perl Archive Toolkit
・ Perl Best Practices
・ Perl Compatible Regular Expressions
・ Perl control structures
・ Perl Cookbook
・ Perl D. Decker
・ Perl Data Language
・ Perl DBI
・ Perl Design Patterns Book
・ Perl Foundation
・ Perl Island
Perl language structure
・ Perl module
・ Perl Mongers
・ Perl Object Environment
・ Perl Object-Oriented Persistence
・ Perl OpenGL
・ Perl package manager
・ Perl PG-130 Penetrator
・ Perl virtual machine
・ Perl, Saarland
・ Perl-UNC Prize
・ Perla
・ Perla (singer)
・ Perla (telenovela)
・ Perla Achával


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Perl language structure : ウィキペディア英語版
Perl language structure
The structure of the Perl programming language encompasses both the syntactical rules of the language and the general ways in which programs are organized. Perl's design philosophy is expressed in the commonly cited motto "there's more than one way to do it". As a multi-paradigm, dynamically typed language, Perl allows a great degree of flexibility in program design. Perl also encourages modularization; this has been attributed to the component-based design structure of its Unix roots, and is responsible for the size of the CPAN archive, a community-maintained repository of more than 100,000 modules.〔(【引用サイトリンク】url=http://www.cpan.org/ )
== Basic syntax ==
In Perl, the minimal Hello World program may be written as follows:

print "Hello, World!\n"

This prints the string ''Hello, World!'' and a newline, symbolically expressed by an n character whose interpretation is altered by the preceding escape character (a backslash). Since version 5.10, the new 'say' builtin produces the same effect even more simply:

say "Hello, World!"

An entire Perl program may also be specified as a command-line parameter to Perl, so the same program can also be executed from the command line (example shown for Unix):

$ perl -e 'print "Hello, World!\n"'

The canonical form of the program is slightly more verbose:

#!/usr/bin/perl
print "Hello, World!\n";

The hash mark character introduces a comment in Perl, which runs up to the end of the line of code and is ignored by the compiler (except on Windows). The comment used here is of a special kind: it’s called the shebang line. This tells Unix-like operating systems to find the Perl interpreter, making it possible to invoke the program without explicitly mentioning perl. (Note that, on Microsoft Windows systems, Perl programs are typically invoked by associating the .pl extension with the Perl interpreter. In order to deal with such circumstances, perl detects the shebang line and parses it for switches.〔(【引用サイトリンク】 perlrun )〕)
The second line in the canonical form includes a semicolon, which is used to separate statements in Perl. With only a single statement in a block or file, a separator is unnecessary, so it can be omitted from the minimal form of the program—or more generally from the final statement in any block or file. The canonical form includes it, because it is common to terminate every statement even when it is unnecessary to do so, as this makes editing easier: code can be added to, or moved away from, the end of a block or file without having to adjust semicolons.
Version 5.10 of Perl introduces a say function that implicitly appends a newline character to its output, making the minimal "Hello World" program even shorter:

use 5.010; # must be present to import the new 5.10 functions, notice that it is 5.010 not 5.10
say 'Hello, World!'


抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Perl language structure」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.